trace()

Availability

Flash Lite 1.0.

Usage

trace(expression)

Operands

expression An expression to evaluate. When a SWF file opens in the Flash authoring tool (by means of the Test Movie command), the value of the expression parameter appears in the Output panel.

Description

Function; evaluates the expression and shows the result in the Output panel in test mode.

Use this function to record programming notes or to display messages in the Output panel while testing a SWF file. Use the expression parameter to check if a condition exists, or to display values in the Output panel. The trace() function is similar to the alert function in JavaScript.

You can use the Omit Trace Actions command in publish settings to remove trace() functions from the exported SWF file.

Example

The following example uses the trace() function to observe the behavior of a while loop:

i = 0;
while (i++ < 5){
    trace("this is execution " add i);
}